package com.bw.service.impl;

import com.alibaba.fastjson.JSON;
import com.bw.entity.Car;
import com.bw.service.CarService;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.List;

@Service
public class CarServiceImpl implements CarService {


    @Override
    public List<Car> selectCarList(String name) {
        System.out.println("CarServiceImpl selectCarList 正在执行");
        List<Car> list = Arrays.asList(Car.builder().id(1).name("java入门").build(), Car.builder().id(2).name("python入门").build());

        return list;
    }

    @Override
    public int addCar(Car book) {
        System.out.println("CarServiceImpl addCar 正在执行");
        return 1;
    }

    @Override
    public int updateCar(Car book) {

        System.out.println("CarServiceImpl updateCar 正在执行");
        return 1;
    }

    @Override
    public int delCar(Integer id) throws InterruptedException {
        Thread.sleep(3*1000);
        System.out.println("CarServiceImpl delCar 正在执行");
        return 0;
    }
}
